/**
 * 
 */
package com.ra.component.mq;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;

import com.espirit.eap.sa.LoginUser;
import com.googlecode.cswish.annotation.cm;

/**
 * 消息
 * @author colin
 * @date 2015年7月7日
 */
@Entity
public class MessageData implements Serializable{
	
	//消息类别:点对点消息
	public static Integer MESSAGE_TYPE_COMMON = 1;
	
	//消息类别:系统消息，所有用户
	public static Integer MESSAGE_TYPE_GLOBAL = 2;
	
	//消息状态:已读
	public static Integer MESSAGE_READED = 1;
	
	//消息状态:未读
	public static Integer MESSAGE_UNREAD = 0;
	
	//消息通道_所有
	public static Integer MESSAGE_CHANNEL_ALL = 0;
	
	//消息通道_WEB系统,默认通道
	public static Integer MESSAGE_CHANNEL_WEB = 1;
	
	//消息通道_短信
	public static Integer MESSAGE_CHANNEL_SMS = 2;
	
	//消息通道_APP客户端
	public static Integer MESSAGE_CHANNEL_APP = 3;

	/**
	 * 序列号
	 */
	private static final long serialVersionUID = -6834714984819301044L;

	private Integer id;
	
	//消息类别(点对点消息：1；系统消息：2)
	@cm("消息类别")
	private Integer messageType;
	
	@cm("消息来源")
	private Integer resource;
	
	@cm("消息发送人")
	private LoginUser sender;
	
	@cm("消息标题")
	private String title;
	
	@cm("消息内容")
	private String content;
	
	@cm("消息创建时间")
	private Date createTime;
	
	@cm("消息接收者")
	private LoginUser receiver;
	
	@cm("消息通道")	
	private Integer channel;
	
	//消息状态(1已读、0未读)
	@cm("消息状态")
	private Integer status;

	@Id
	@GeneratedValue
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Integer getMessageType() {
		return messageType;
	}

	public void setMessageType(Integer messageType) {
		this.messageType = messageType;
	}

	public Integer getResource() {
		return resource;
	}

	public void setResource(Integer resource) {
		this.resource = resource;
	}

	@ManyToOne(fetch=FetchType.LAZY)
	public LoginUser getSender() {
		return sender;
	}

	public void setSender(LoginUser sender) {
		this.sender = sender;
	}
	
	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	@ManyToOne(fetch=FetchType.LAZY)
	public LoginUser getReceiver() {
		return receiver;
	}

	public void setReceiver(LoginUser receiver) {
		this.receiver = receiver;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}
	
	public Integer getChannel() {
		return channel;
	}

	public void setChannel(Integer channel) {
		this.channel = channel;
	}
}
